#include<bits/stdc++.h>
using namespace std;
int main() {
	int a, b, c, d;
	scanf("%d %d %d %d", &a, &b, &c, &d);
	int res_h = c - a;
	int res_m = d - b;
	if (res_m > 60 ) {
		res_h += 1;
		res_m -= 60;
	} else if (res_m < 0) {
		res_h -= 1;
		res_m += 60;
	}
	printf("%d %d", res_h, res_m);
	return 0;
}
